package com.jt.www.enums;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public enum OrderTypeEnum implements BaseEnum {
    ORDER(1, "保单", "01"),
    ENDORSEMENT(2, "批单", "02");

    private int code;
    private String msg;
    private String bmsCode;

    OrderTypeEnum(int code, String name, String bmsCode) {
        this.code = code;
        this.msg = name;
        this.bmsCode = bmsCode;
    }

    public static List<Map<String, Object>> getMapList() {
        ArrayList list = new ArrayList();
        for (OrderTypeEnum orderTypeEnum : OrderTypeEnum.values()) {
            list.add(orderTypeEnum.toMap());
        }
        return list;
    }

    public static OrderTypeEnum getEnumByCode(int code) {
        for (OrderTypeEnum e : OrderTypeEnum.values()) {
            if (Integer.parseInt(e.getCode().toString()) == code) {
                return e;
            }
        }
        return null;
    }

    @Override
    public Object getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public String getBmsCode() {
        return bmsCode;
    }
}
